package generic;

/**
 * 泛型类
 * @param <T>
 */
public class GenericB<T extends Number> {//指定泛型的边界，只能是Number的子类

    T key;

    public T getKey() {
        return this.key;
    }



    public static void main(String[] args) {
        GenericB genericB = new GenericB<Integer>();
        System.out.println(genericB);

/*        GenericB genericB = new GenericB<String>(); //报错，类型错误
        System.out.println(genericB);*/
    }
}
